<a href='https://github.com/angular/angular.js/edit/v1.6.x/src/ng/filter.js?message=docs($filter)%3A%20describe%20your%20change...#L71' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this Doc</a>



<a href='https://github.com/angular/angular.js/tree/v1.6.6/src/ng/filter.js#L71' class='view-source pull-right btn btn-primary'>
  <i class="glyphicon glyphicon-zoom-in">&nbsp;</i>View Source
</a>


<header class="api-profile-header">
  <h1 class="api-profile-header-heading">$filter</h1>
  <ol class="api-profile-header-structure naked-list step-list">
    
  <li>
    <a href="api/ng/provider/$filterProvider">- $filterProvider</a>
  </li>

    <li>
      - service in module <a href="api/ng">ng</a>
    </li>
  </ol>
</header>





<div class="api-profile-description">
  <p>Filters are used for formatting data displayed to the user.</p>
<p>They can be used in view templates, controllers or services.Angular comes
with a collection of <a href="api/ng/filter">built-in filters</a>, but it is easy to
define your own as well.</p>
<p>The general syntax in templates is as follows:</p>
<pre><code class="lang-html">{{ expression [| filter_name[:parameter_value] ... ] }}
</code></pre>

</div>




<div>
  

  

  <h2 id="usage">Usage</h2>
    
      <p><code>$filter(name);</code></p>


    

    
<section class="api-section">
  <h3>Arguments</h3>

<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        name
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">String</a>
      </td>
      <td>
        <p>Name of the filter function to retrieve</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

</section>
    
    <h3>Returns</h3>
<table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-function">Function</a></td>
    <td><p>the filter function</p>
</td>
  </tr>
</table>

  
  
  



  
  <h2 id="example">Examples</h2><p>

<div>
  <plnkr-opener example-path="examples/example-$filter"></plnkr-opener>

  <div class="runnable-example"
      path="examples/example-$filter"
      name="$filter"
      module="filterExample">

  
    <div class="runnable-example-file" 
      name="index.html"
      language="html"
      type="html">
      <pre><code>&lt;div ng-controller=&quot;MainCtrl&quot;&gt;&#10; &lt;h3&gt;{{ originalText }}&lt;/h3&gt;&#10; &lt;h3&gt;{{ filteredText }}&lt;/h3&gt;&#10;&lt;/div&gt;</code></pre>
    </div>
  
    <div class="runnable-example-file" 
      name="script.js"
      language="js"
      type="js">
      <pre><code>angular.module(&#39;filterExample&#39;, [])&#10;.controller(&#39;MainCtrl&#39;, function($scope, $filter) {&#10;  $scope.originalText = &#39;hello&#39;;&#10;  $scope.filteredText = $filter(&#39;uppercase&#39;)($scope.originalText);&#10;});</code></pre>
    </div>
  

    <iframe class="runnable-example-frame" ng-src="{{getExampleIndex('examples/example-$filter')}}" name="example-$filter"></iframe>
  </div>
</div>


</p>

</div>


